package person.bangbang.im.Androidgin;

import android.content.Context;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;

import person.bangbang.im.Androidgin.Util.Log;
/**
 * Global pref setting.
 * Corporate with PrefActivity
 * 
 * @author bangbang.song@gmail.com
 */
public final class AndroidginPref {
	/**
	 * silent mode or not.
	 */
	public static final String KEY_IS_SLIENT = "pref_is_silent";

	public final static String KEY_REM = "pref_rem_password";

	public final static String KEY_AUTO_LOGIN = "pref_auto_login";
	
	public final static String KEY_NOTIFY_RCVD = "pref_notify_rcvd_msg";
	

	
	private Context mCon;
	private static AndroidginPref _instance;
	private SharedPreferences p;
	
	private AndroidginPref(Context con) {
		mCon = con;
		p = PreferenceManager.getDefaultSharedPreferences(con);
	}
	
	public static AndroidginPref getInstance(Context con) {
		if (null == _instance) {
			_instance = new AndroidginPref(con);
		}
		
		return _instance;
	}
	
	public boolean isSlient(){
		return p.getBoolean(KEY_IS_SLIENT, false);
	}
	public boolean remPWD() {
		return p.getBoolean(KEY_REM, true);
	}
	public boolean autoLogin() {
		return p.getBoolean(KEY_AUTO_LOGIN, true);
	}
	public boolean notifyRcvdMsg() {
		return p.getBoolean(KEY_NOTIFY_RCVD, true);
	}
}
